package org.jeecg.modules.chvegetable.controller;/**
 * @author gf
 * @create 2023-2-28 10:11
 */

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.chvegetable.entity.FlowerInOutReports;
import org.jeecg.modules.chvegetable.service.IReportsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gf
 * @ClassName Reports
 * @description: TODO
 * @datetime 2023年 02月 28日 10:11
 * @version: 1.0
 **/
@RestController
@RequestMapping("/vegetables/report/")
public class Reports {

    @Autowired
    IReportsService reportsService;

    @GetMapping("inOutReport")
    @AutoLog(value = "进销存报表-inOutReport")
    @ApiOperation(value="进销存报表- ", notes="进销存报表- inOutReport")
    public JSONObject inOutReport(@RequestParam("sDate") String sDate, @RequestParam(value = "eDate",required = false,defaultValue = "") String eDate, @RequestParam(value = "storehouse",required = false,defaultValue = "") String storehouse) {
        QueryWrapper<FlowerInOutReports> queryWrapper = new QueryWrapper<>();
        if(StringUtils.isNotBlank(storehouse )) {
            queryWrapper.eq("storehouse", storehouse);
        }
        JSONObject flowerInOutReportsInfos = reportsService.getFlowerInOutReportsInfos(queryWrapper, sDate);
        return flowerInOutReportsInfos;
    }


}